<div class="grid-100 row">
    <div class="grid-content grid-100"  ng-keyup="keyUpSearch($event)">
        <div class="grid-parent grid-100 container">
            <h1 class="section-label pull-left">Material Template</h1>
            <a class="create-button" href="#/fd/material-template/add" permission-check="{{'materialTemplate_write'}}">
                                    <b>Add Material Template</b>
                                  </a>
            <hr>
        </div>

        <div class="grid-parent grid-100 container">
            <div class="grid-50">
                <label class="label-input">name</label>
                <input type="text" ng-model="searchInfo.name" class="form-control" placeholder="Type name to search" />
            </div>
        </div>
        <div class="grid-parent grid-100 container">
            <div class="grid-90">&nbsp;</div>
            <div class="grid-10 ">

                <waitting-btn type="button" btn-class="ripplelink" ng-click="search()" value="'Search'" is-loading="!searchCompleted"></waitting-btn>
            </div>
        </div>
    </div>
</div>
<div class="grid-100 row">
    <div class="grid-content grid-100">
        <div class="grid-parent grid-100 container">
            <div ng-repeat="materialTemplate in materialTemplateView track by $index" style="border: 1px solid #e7ecf1;margin-bottom: 20px;  border-radius: 4px; background-color: #fff;">

                <div class="portlet light ">
                    <div class="portlet-title" style="margin-bottom: 0;line-height: 40px;font-size: 18px; border-bottom: 1px solid #ddd; background-color: #f5f5f5;border-color: #ddd;">
                        <div style="padding-left: 15px;display: inline-block;">
                            <span class="caption-subject">
                                    <label><b style="color:#000">{{materialTemplate.name}}</b></label>
                                </span>
                        </div>
                        <div class="actions" style="padding-bottom: 6px; padding-right: 6px;" permission-check="{{'materialTemplate_write'}}">
                            <a ui-sref="fd.materialTemplate.edit({materialTemplateId:materialTemplate.id})">Edit</a>
                            <!--<a href="#" ng-click="remove($index)">Delete</a>-->
                        </div>
                    </div>

                </div>
                <div id="collapseThree" style="padding: 15px;">
                    <table class="table">
                        <thead>
                            <th>Item</th>
                            <th>UOM</th>
                            <th>QTY</th>
                        </thead>
                        <tbody>
                            <tr ng-repeat="item in materialTemplate.materialItems">
                                <td>
                                    <item-display item="item"></item-display>
                                </td>
                                <td>{{item.unitName}}</td>
                                <td>{{item.qty}}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="grid-100">
    <div class="grid-content grid-100">
        <unis-pager total-count="materialTemplate.length" page-size="pageSize" load-content="loadContent(currentPage)"> </unis-pager>
    </div>
</div>